<?php
	error_reporting(E_ERROR | E_WARNING | E_PARSE);
	//链接数据库
	$conn = mysql_connect('127.0.0.1',"root","");
	if(!$conn){
		echo "链接错误";
		exit();
	}
	//选择数据库
	if (!mysql_query("use messageboard",$conn)) {
		echo "数据库链接失败";
		exit();
	}
	//选择字符集
	mysql_query("set names utf8",$conn);
	//生成时间戳
	$time = time();
	//拼凑sql语句。
	$sql = "insert into data values (null,\"{$_POST['name']}\",\"{$_POST['write']}\",$time)";
	//执行sql语句
	mysql_query($sql,$conn);
	//跳转回主页
	header("Location:index.php");
?>